﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

using System.Data;
using eSYSU.Business;
using eSYSU.Common;
using eSYSU.Model;


/// <summary>
/// eSYSU用户相关的网络服务
/// </summary>
[WebService(Namespace = "http://esysu.com/ws/", Name = "eSYSU User Related Web Service",
    Description = "中大e家用户相关服务的网络服务，使用本服务请先提交使用申请并在使用时遵循中大e家网络服务协议。")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。 
// [System.Web.Script.Services.ScriptService]
public class WS_User : System.Web.Services.WebService {

    public WS_User () {

        //如果使用设计的组件，请取消注释以下行 
        //InitializeComponent(); 
    }

    /// <summary>
    /// 添加一个新用户
    /// </summary>
    /// <param name="user">用户类的对象</param>
    /// <returns>新用户的ID</returns>
    /// <remarks>如果添加失败，则返回string.Empty</remarks>
    [WebMethod(Description = "添加一个新用户")]
    public string InserUser(eSYSU.Model.User user)
    {
        return "82309482";
    }


    /// <summary>
    /// 获取指定用户的信息
    /// </summary>
    /// <param name="iUserID">用户ID</param>
    /// <returns>包含指定用户信息的XML结构的字符串</returns>
    [WebMethod(Description = "获取指定用户的信息")]
    public string GetUserInfo(int iUserID)
    {
        return "My name is Steve Jobs";
    }

    /// <summary>
    /// 用户登录验证
    /// </summary>
    /// <param name="sUserName">用户名</param>
    /// <param name="sPassword">登陆密码</param>
    /// <returns>验证结果</returns>
    [WebMethod(Description = "用户登录验证")]
    public bool Login(string sUserName, string sPassword)
    {
        return UserService.UserLogin(sUserName, sPassword);
    }


    /// <summary>
    /// 用户名查重
    /// </summary>
    /// <param name="sUserName">用户名</param>
    /// <returns>检查结果</returns>
    /// <remarks></remarks>
    [WebMethod(Description = "用户名查重")]
    public bool IsUserNameExists(string sUserName)
    {
        return true;
    }
}
